source("../R/goldstandanalysis.R")

rm(list=ls())
?read.table
tmpWater <- read.table("Water.txt",header=T)

golds=tmpWater
table(golds$dataDilution)
notNa <- golds[!is.na(golds$Area),]



golds2 <- golds
head(golds2)
dim(golds2)
length(which(golds2$Area<=0))

transres <- computeTransitionStats(golds2)
head(transres)
dim(transres)
resYeast <- ratiosOfTransitionList(transres)

res <- resYeast
all <- NULL
for(i in 0:9){
  res2 <- res[(res$dil1-i)==res$dil2,]
  xx <- log2(res2$area2/res2$area1)
  all <- rbind(all,cbind(rep(i+1,length(xx)),xx))
}
dim(all)
colnames(all)<-c("dil","ratio")
boxplot(all[,"ratio"]~all[,"dil"])
abline(c(1,-1),col=2)
unique(all[,"dil"])

transfil<-transres[!is.na(transres$marea),]
head(transfil)
dim(transfil)
transfil <- transfil[transfil$mcarea >0 ,]

yeast <- TRUE
if(yeast){#fix for yeast
  transfil$dataDilution[transfil$dataDilution==11] <- 10
  transfil$dataID[transfil$dataID=="L120229"] <- "L120228"
}

x <- table(transfil$dataDilution,unlist(transfil$dataID))
barplot(x,beside=T,ylim=c(0,400))
